﻿
@{
    ViewBag.Title = "list";
    Layout = null;
}

<!DOCTYPE html>
<html>
<head>
    <meta charset="utf-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">

    <title>H+ 后台主题UI框架 - jqGird</title>
    <meta name="keywords" content="H+后台主题,后台bootstrap框架,会员中心主题,后台HTML,响应式后台">
    <meta name="description" content="H+是一个完全响应式，基于Bootstrap3最新版本开发的扁平化主题，她采用了主流的左右两栏式布局，使用了Html5+CSS3等现代技术">
    <link rel="shortcut icon" href="/skin/H4.2/favicon.ico">
    <link href="/skin/H4.2/css/bootstrap.min.css?v=3.3.6" rel="stylesheet">
    <link href="/skin/H4.2/css/font-awesome.css?v=4.4.0" rel="stylesheet">
    <!-- jqgrid-->
    <link href="/skin/H4.2/css/plugins/jqgrid/ui.jqgrid.css?0820" rel="stylesheet">
    <link href="/skin/H4.2/css/animate.css" rel="stylesheet">
    <link href="/skin/H4.2/css/style.css?v=4.1.0" rel="stylesheet">
    <style>
        /* Additional style to fix warning dialog position */

        #alertmod_table_list_2 {
            top: 900px !important;
        }

        #pager_list_1_left {
            display: none;
        }
    </style>
</head>
<body class="gray-bg ">
    <div class="wrapper wrapper-content  animated fadeInRight">
        <div class="row">
            <div class="col-sm-12">
                <div class="ibox ">
                    @*<div class="ibox-title">
                            <h5>jQuery Grid Plugin – jqGrid</h5>
                        </div>*@
                    <div class="ibox-content">
                        <form role="form" class="form-inline" id="form1" name="form1">
                            <div class="form-group">
                                <label for="exampleInputEmail2" class="sr-only">用户名</label>
                                <input type="email" placeholder="请输入用户名" id="name" name="name" class="form-control">
                            </div>
                            <div class="form-group">
                                <label for="exampleInputPassword2" class="sr-only">密码</label>
                                <input type="password" placeholder="请输入密码" id="password" name="password" class="form-control">
                            </div>
                            <button class="btn btn-white" type="button" id="btnsearch">查询</button>
                        </form>
                    </div>
                    <div class="ibox-content">
                        <div class="jqGrid_wrapper">
                            <table id="table_list_1"></table>
                            <div id="pager_list_1"></div>
                        </div>
                        <p>&nbsp;</p>

                    </div>
                </div>
            </div>
        </div>
    </div>
    <!-- 全局js -->
    <script src="/skin/H4.2/js/jquery.min.js?v=2.1.4"></script>
    <script src="/skin/H4.2/js/bootstrap.min.js?v=3.3.6"></script>

    <!-- Peity -->
    <script src="/skin/H4.2/js/plugins/peity/jquery.peity.min.js"></script>
    <!-- jqGrid -->
    <script src="/skin/H4.2/js/plugins/jqgrid/i18n/grid.locale-cn.js?0820"></script>
    <script src="/skin/H4.2/js/plugins/jqgrid/jquery.jqGrid.min.js?0820"></script>
    <!-- 自定义js -->
    <script src="/skin/H4.2/js/content.js?v=1.0.0"></script>
    <!-- Page-Level Scripts -->
    <script>
        $.fn.serializeObject = function () {
            var o = {};
            var a = this.serializeArray();
            $.each(a, function () {
                if (o[this.name]) {
                    if (!o[this.name].push) {
                        o[this.name] = [o[this.name]];
                    }
                    o[this.name].push(this.value || '');
                } else {
                    o[this.name] = this.value || '';
                }
            });
            return o;
        };

        $(document).ready(function () {

            $("#btnsearch").click(function () {
                $("#table_list_1").jqGrid('setGridParam', {
                    postData: $('#form1').serializeObject(),
                    page: 1
                }).trigger("reloadGrid"); //重新载入
            });
            var jsonuserinfo = $('#form1').serializeObject();

            $.jgrid.defaults.styleUI = 'Bootstrap';
            $("#table_list_1").jqGrid({
                url: '/Hhome/list',
                //data: mydata,
                datatype: "json",
                mtype: 'POST',
                height: '500',
                autowidth: true,
                shrinkToFit: true,
                multiselect: true,
                multiboxonly: true,
                postData:$('#form1').serializeObject(),
                cellEdit: true,
                rowNum: 15,
                rowList: [10, 20, 30],
                colNames: ['序号', '日期', '客户', '金额', '运费', '总额', '备注'],
                colModel: [
                    {
                        name: 'id',
                        index: 'id',
                        width: 60,
                        sorttype: "int"
                    },
                    {
                        name: 'invdate',
                        index: 'invdate',
                        width: 90,
                        sorttype: "date",
                        formatter: "date"
                    },
                    {
                        name: 'name',
                        index: 'name',
                        width: 100
                    },
                    {
                        name: 'amount',
                        index: 'amount',
                        width: 80,
                        align: "right",
                        sorttype: "float",
                        formatter: "number"
                    },
                    {
                        name: 'tax',
                        index: 'tax',
                        width: 80,
                        align: "right",
                        sorttype: "float"
                    },
                    {
                        name: 'total',
                        index: 'total',
                        width: 80,
                        align: "right",
                        sorttype: "float"
                    },
                     {
                         label: '启用', name: 'id', index: 'id', width: 45, align: 'center',
                        formatter: function (cellvalue, options, rowObject) {
                            return "<a href='" + cellvalue + "'>编辑</a>";

                        },
                    },

                ],
                pager: "#pager_list_1",
                viewrecords: true,
                // caption: "jqGrid 示例1",
                hidegrid: false
            });
            // Add responsive to jqGrid
            $(window).bind('resize', function () {
                var width = $('.jqGrid_wrapper').width();
                $('#table_list_1').setGridWidth(width);
                $('#table_list_2').setGridWidth(width);
            });
        });
    </script>

</body>
</html>
